import { RolechInstance } from './types'
import Rolech from './core/Rolech'
import { extend } from './helpers/utils'

function createInstance(): RolechInstance {
  const context = new Rolech()
  let instance = Rolech.prototype.request.bind(context)

  extend(instance, context)

  return instance as unknown as RolechInstance
}

const rolech = createInstance()

export default rolech
